package com.xbongbong.saas.model;

import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.saas.domain.entity.PublicGroupCustomerEntity;

import java.util.List;
import java.util.Map;

/**
 * @description: 公海池客户
 * @Author: hongxiao
 * @date: 2019-03-05 22:31
 * @since v1.0
 */
public interface PublicGroupCustomerModel extends IModel<PublicGroupCustomerEntity> {
    Integer save(PublicGroupCustomerEntity entity);

    Integer insertBatch(List<PublicGroupCustomerEntity> list);

    Integer deleteByKey(Long key,String corpid);

    PublicGroupCustomerEntity getByKey(Long key,String corpid);

    Integer deleteByPublicGroupId(Long publicGroupId,String corpid);

    /**
     * 删除某些分组所有的（或与某客户的）关联关系
     * @param publicGroupIdIn 公海池分组idIn
     * @param corpid 公司id
     * @param customerId 客户id
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-03-06 10:27
     * @since v1.0
     * @version v1.0
     */
    Integer deleteByPublicGroupIdList(List<Long> publicGroupIdIn, String corpid, Long customerId);

    /**
     * 删除客户对应的公海池客户
     * @param customerId 公司id
     * @param corpid 公司id
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-03-06 10:26
     * @since v1.0
     * @version v1.0
     */
    Integer deleteByCustomerId(Long customerId,String corpid);

    /**
     * 删除某一公海池分组下的公海池客户
     * @param customerIdIn 客户idIn
     * @param corpid 公司id
     * @param publicGroupId 公海池分组id
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-03-06 10:24
     * @since v1.0
     * @version v1.0
     */
    Integer deleteByCustomerIdList(List<Long> customerIdIn,String corpid,Long publicGroupId);

    /**
     * 获取公海池客户的客户列表
     * @param param 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-03-06 10:23
     * @since v1.0
     * @version v1.0
     */
    List<Long> findCustomerIds(Map<String ,Object> param);

    /**
     * 获取公海分组已关联客户数的对应关系
     * @param param 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-03-06 10:23
     * @since v1.0
     * @version v1.0
     */
    List<Map<String,Object>> getBindCountMap(Map<String,Object> param);
}
